
/**
 * 改用toCharArray
 */
public class p1013_2_125ms {

	public static//
	// -----
	// -----
	class Main {
		public static void main(String[] args) throws Exception {
			java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
			int n = Integer.parseInt(reader.readLine());
			for (int i = 0; i < n; i++) {
				coins = new int[12];
				for (int j = 0; j < 3; j++) {
					String[] parts = reader.readLine().split(" ");
					join(parse(parts[2].charAt(0), parts[0], parts[1]));
				}
				print();
			}
		}

		static int[] coins; // 0/1/2/-2=noidea/true/light/heavy

		static int[] parse(char result, String left, String right) {
			int[] data = new int[12];
			if (result == 'e') {
				for (char c : left.toCharArray())
					data[c - 'A'] = 1;
				for (char c : right.toCharArray())
					data[c - 'A'] = 1;
			} else {
				int lVal = result == 'u' ? -2 : 2;
				int rVal = -lVal;
				for (char c : left.toCharArray())
					data[c - 'A'] = lVal;
				for (char c : right.toCharArray())
					data[c - 'A'] = rVal;
				for (int i = 0; i < 12; i++)
					if (data[i] == 0)
						data[i] = 1;
			}
			return data;
		}

		static void join(int[] data) {
			for (int i = 0; i < 12; i++) {
				int v = coins[i];
				int d = data[i];
				if (v == 1 || v == d) {
				} else if (v == 0) {
					coins[i] = d;
				} else if (d == 1 || v + d == 0) {
					coins[i] = 1;
				}
			}
		}

		static void print() {
			for (int i = 0; i < 12; i++)
				if (coins[i] != 1) {
					System.out.println((char) ('A' + i) + " is the counterfeit coin and it is "
							+ (coins[i] == 2 ? "light" : "heavy") + ".");
					return;
				}
		}
	}

	// -----
	// -----

	public static void main(String[] args) throws Exception {
		Judge.run();
	}

}
